/* SPDX-License-Identifier: GPL-2.0 */

#include <common.h>
#include <cpu_func.h>
#include <dm.h>
#include <log.h>
#include <clk.h>
#include <blk.h>
#include <image.h>
#include <spl.h>
#include <hang.h>
#include <init.h>
#include <debug_uart.h>
#include <asm/arch-apsilicon/boot_param.h>


u32 spl_boot_device(void)
{
	u32 bootdev = BOOT_DEVICE_NONE;
	enum boot_device bd;

	bd = ap_get_boot_device();
	switch (bd) {
	case BD_SDMC0:
		bootdev = BOOT_DEVICE_MMC1;
		break;
	case BD_SDMC1:
		bootdev = BOOT_DEVICE_MMC2;
		break;
	case BD_SPINOR:
		bootdev = BOOT_DEVICE_SPI;
		break;
	case BD_BOOTROM:
		bootdev = BOOT_DEVICE_BOOTROM;
		break;
	default:
		bootdev = BOOT_DEVICE_NONE;
		log_err("Boot device: Unknown, %d\n", (int)bd);
		break;
	}

	return bootdev;
}

